package com.martin.lib_base.ktx

import java.text.DecimalFormat

/**
 * @author：孟凡华
 * @date：2021/12/14 15:18
 */

fun Number.limit(count: Int = 2): String {
    val pattern = StringBuffer("0.")
    for (i in 0 until count) {
        pattern.append("0")
    }
    return DecimalFormat(pattern.toString()).format(this)
}
